Encoding:

P32A

001000

rt

rs

rd

ADDU.PH

0

0100001

101

P32A

001000

rt

rs

rd

ADDU_S.PH

1

0100001

101

6

5

5

5

1

7

3

Format:

ADDU[_S].PH 

Unsigned Add Integer Halfwords

ADDU.PH   rd, rs, rt

DSP-R2

Unsigned Add Integer Halfwords

ADDU_S.PH rd, rs, rt

DSP-R2

Unsigned Add Integer Halfwords

Purpose:

Unsigned Add Integer Halfwords

Add two pairs of unsigned integer halfwords, with optional saturation.

Description:

rd = sat16(rs31..16 + rt31..16) || sat16(rs15..0 + rt15..0)

The two unsigned integer halfword elements in register rt are added to the corresponding unsigned integer halfword elements in register rs.

For the non-saturating version of the instruction, the result modulo 65,536 is written into the corresponding element in register rd.

For the saturating version of the instruction, the addition is performed using unsigned saturating arithmetic. Results that overflow are clamped to the lar gest representable value (65,535 decimal, 0xFFFF hexadecimal) before being written to the destination register rd.

For either instruction, if any of the individual additions result in overflow or saturation, a 1 is written to bit 20 in the

DSPControl register within the ouflag field.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

ADDU.PH:
   ValidateAccessToDSP2Resources()
   tempB15..0 = addU16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = addU16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0
ADDU_S.PH:
   ValidateAccessToDSP2Resources()
   tempB15..0 = satAddU16( GPR[rs]31..16 , GPR[rt]31..16 )
   tempA15..0 = satAddU16( GPR[rs]15..0 , GPR[rt]15..0 )
   GPR[rd]31..0 = tempB15..0 || tempA15..0

Exceptions:

Reserved Instruction, DSP Disabled